package io.renren.sf.controller;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;

import io.renren.sf.entity.CbFixUnitEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.sf.entity.CbExpandEditionEntity;
import io.renren.sf.service.CbExpandEditionService;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author cyl_txw
 * @email cyl_txw@gmail.com
 * @date 2021-08-08 13:31:02
 */
@RestController
@RequestMapping("sf/cbexpandedition")
public class CbExpandEditionController {
    @Autowired
    private CbExpandEditionService cbExpandEditionService;

    /**
     * 获取软笔扩展版本
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        List<CbExpandEditionEntity> list = cbExpandEditionService.getVersionZyflAndBbzy(params);
        return R.ok().put("editionList", list);
    }

    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    //@RequiresPermissions("sf:cbexpandedition:info")
    public R info(@PathVariable("id") Long id){
		CbExpandEditionEntity cbExpandEdition = cbExpandEditionService.getById(id);
        return R.ok().put("cbExpandEdition", cbExpandEdition);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    //@RequiresPermissions("sf:cbexpandedition:save")
    public R save(@RequestBody CbExpandEditionEntity cbExpandEdition){
        cbExpandEdition.setCreatetime(new Date());
		cbExpandEditionService.save(cbExpandEdition);
        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    //@RequiresPermissions("sf:cbexpandedition:update")
    public R update(@RequestBody CbExpandEditionEntity cbExpandEdition){
		cbExpandEditionService.updateById(cbExpandEdition);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //@RequiresPermissions("sf:cbexpandedition:delete")
    public R delete(@RequestBody Long[] ids){
		cbExpandEditionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
